<?php 
include_once('connection/connection.php');  /*connection establishment*/
include('header.php');
include('menu.php');
include('config.php');
$block=$_SESSION['form_id']; /*dropdown passes block id on session*/
$district=$_SESSION['district']; /*dropdown passes district id on session*/
?>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Critical Village Profile</title>

<!-- internal CSS call inside current page -->

<style type="text/css">
.style10 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9px; color:#000000}
.style11 {font-size: 9px}
td{padding-left:2px; padding-right:2px;}
</style>

<!--  end --->

</head>
<body>
<?php

/*session value stored in a variable*/

$distId=$district;
$blockId=$block;

/*-------------- use query for display name of district and block---------------- */

$sqlReport1 = "SELECT district_name,block_name FROM tbl_lookup_location WHERE district_id='$distId' and block_id='$blockId'";
$queryReport1 = mysql_query($sqlReport1);
$record=mysql_fetch_array($queryReport1);

/*----------------------------- end query -----------------------------------------*/



/*-----------------------------------Select Data from lookup location table village wise for main loop----------------------------------------*/

$sqlReport = "SELECT distinct block_id,village_id,block_name,village_name,census_village_code FROM tbl_lookup_location WHERE district_id='$distId' and block_id='$blockId' order by village_name";
$queryReport = mysql_query($sqlReport);

/*----------------------------- -------------------------end query --------------------------------------------------------------------------*/


//query for find Population factor of corresponding district

$sqlPopFactor="select * from tbl_lookup_pop_factor where district_id='$distId'";
$queryPopFactor= mysql_query($sqlPopFactor);
$rowPopFactor=mysql_fetch_array($queryPopFactor);
$population_factor=$rowPopFactor['population_factor'];
$factor_2025=$rowPopFactor['factor_2025'];

//find lpcd for 12 district

if(($distId == 389) || ($distId ==390) || ($distId == 391) || ($distId ==392) || ($distId ==398) || ($distId == 401) || ($distId == 402) || ($distId == 403) || ($distId == 404) || ($distId == 405) || ($distId == 406) || ($distId == 416))
{
	$lpcd=60;
}
else
{
	$lpcd=30;
}

?>
<table border="0" width="2420" cellspacing="0" cellpadding="0">
	<tr>
		<td width="2420" height="26" bgcolor="#E9E9E9">
		<p align="center"><span style="font-size: 9pt; font-weight: 700">
	  <font face="Verdana" color="#224568">PROFILE OF CRITICAL VILLAGES AS PER SURVEY</font></span></td>
	</tr>
	<tr>
	  <td bgcolor="#E9E9E9" height="26"><div align="left"><font face="Verdana" style="font-size: 9pt; font-weight: 700" color="#224568">District :<?php echo $record['district_name'];?> &nbsp;&nbsp;&nbsp;Block : <?php echo $record['block_name'];?></font></div></td>
  </tr>
	
	<tr>
	  <td><table border="1" width="2600" cellspacing="0" cellpadding="0" height="235" bordercolor="#FFFFFF" style="border: 1px solid #BBD1E8" bgcolor="#F9F9F9">
        <tr bgcolor="#C5D8EB">
          <td width="88" rowspan="4" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Name of the critical village</font></td>
          <td width="63" rowspan="4" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Census code no.</font></td>
          <td height="43" colspan="2" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Scheme under which the village is covered</font></td>
          <td width="93" rowspan="4" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Operational Status of the scheme (Functional/ Non functional)</font></td>
          <td width="77" rowspan="4" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Category of the village (Gen/SC/ST)</font></td>
          <td width="77" rowspan="4" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Population of the village (2001)</font></td>
		  <td width="77" rowspan="4" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Population of the village (2010)</font></td>
		  <td width="77" rowspan="4" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Population of the village (2025)</font></td>
          <td colspan="3" rowspan="2" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Water Requirement of the village (KLD) in 2010</font></td>
		  <td colspan="3" rowspan="2" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Water Requirement of the village (KLD) in 2025</font></td>
          <td colspan="15" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">PHED sources in the village & their production</font></td>
          <td colspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Total quantity of water supplied to village (KLD)</span></font> </td>
          <td colspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Excess/ Shortfall (KLD) in 2010</span></font></td>
		  <td colspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Excess/ Shortfall (KLD) in 2025</span></font></td>
          <td colspan="2" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Duration of Supply (Hrs)</span></font></td>
		  <td colspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Service Level (lpcd) in 2010</span></font></td>
		  <td colspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Service Level (lpcd) in 2025</span></font></td>
          <td width="52" rowspan="4" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Reasons of shortfall</span></font></td>
          <td width="64" rowspan="4" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Suggested measures</span></font></td>
          <td width="60" rowspan="4" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Likely cost of the measures (Rs. in lacs)</span></font></td>
        </tr>
        <tr bgcolor="#C5D8EB">
          <td width="64" rowspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Type of scheme (HP/P&T/ Piped/ RWSS/ Other)</span></font></td>
          <td width="102" rowspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Name of the scheme</span></font></td>
          <td colspan="6" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Functional HPs</font></td>
          <td width="89" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Non Functional (Repaairable) HPs</font></td>
          <td colspan="6" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Functional TWs/Ows</font></td>
          <td width="80" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Non Functional (repairable)TWs/OWs</font></td>
          <td width="80" rowspan="3" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Production from local surface source if any (KLD)</font></td>
          <td width="75" rowspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Potable</span></font></td>
          <td width="67" rowspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Non potable</span></font></td>
          <td width="65" rowspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Total</span></font></td>
          <td width="74" rowspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">For HH security</span></font></td>
          <td width="66" rowspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">For other needs</span></font></td>
          <td width="59" rowspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Total</span></font></td>
		  <td width="74" rowspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">For HH security</span></font></td>
          <td width="66" rowspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">For other needs</span></font></td>
          <td width="59" rowspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Total</span></font></td>
          <td width="53" rowspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Designed</span></font></td>
          <td width="35" rowspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Actual</span></font></td>
		  <td width="74" rowspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">For HH security</span></font></td>
          <td width="66" rowspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">For other needs</span></font></td>
          <td width="59" rowspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Total</span></font></td>
		  <td width="74" rowspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">For HH security</span></font></td>
          <td width="66" rowspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">For other needs</span></font></td>
          <td width="59" rowspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Total</span></font></td>
        </tr>
        <tr bgcolor="#C5D8EB">
          <td width="71" rowspan="2" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">For Household security</font></td>
          <td width="57" rowspan="2" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">For other needs</font></td>
          <td width="48" rowspan="2" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Total</font></td>
		  <td width="71" rowspan="2" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">For Household security</font></td>
          <td width="57" rowspan="2" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">For other needs</font></td>
          <td width="48" rowspan="2" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Total</font></td>
          <td height="16" colspan="2" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Potable</font></td>
          <td colspan="2" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Non potable</font></td>
          <td colspan="2" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Total</font></td>
          <td rowspan="2" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Nos.</font></td>
          <td colspan="2" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Potable</span></font></td>
          <td colspan="2" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Non potable</span></font> </td>
          <td colspan="2" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Total</span></font></td>
          <td width="80" rowspan="2" align="center"><font face="Verdana" color="#000000"><span style="font-size: 8.5pt">Nos.</span></font></td>
        </tr>
        <tr bgcolor="#C5D8EB">
          <td width="51" align="center"><font face="Verdana" color="#000000"><span style="font-size: 8.5pt">Nos.</span></font></td>
          <td width="71" align="center"><font face="Verdana" color="#000000"><span style="font-size: 8.5pt">Production (KLD)</span></font></td>
          <td width="44" align="center"><font face="Verdana" color="#000000"><span style="font-size: 8.5pt">Nos.</span></font></td>
          <td width="74" align="center"><font face="Verdana" color="#000000"><span style="font-size: 8.5pt">Production (KLD)</span></font></td>
          <td width="46" align="center"><font face="Verdana" color="#000000"><span style="font-size: 8.5pt">Nos.</span></font></td>
          <td width="77" align="center"><font face="Verdana" color="#000000"><span style="font-size: 8.5pt">Production (KLD)</span></font></td>
          <td width="43" align="center"><font face="Verdana" color="#000000"><span style="font-size: 8.5pt">Nos.</span></font></td>
          <td width="64" align="center"><font face="Verdana" color="#000000"><span style="font-size: 8.5pt">Production (KLD)</span></font></td>
          <td width="46" align="center"><font face="Verdana" color="#000000"><span style="font-size: 8.5pt">Nos.</span></font></td>
          <td width="64" align="center"><font face="Verdana" color="#000000"><span style="font-size: 8.5pt">Production (KLD)</span></font></td>
          <td width="54" align="center"><font face="Verdana" color="#000000"><span style="font-size: 8.5pt">Nos.</span></font></td>
          <td width="64" align="center"><font face="Verdana" color="#000000"><span style="font-size: 8.5pt">Production (KLD)</span></font></td>
        </tr>
        <tr>
          <td height="14" align="center"><span class="style10">1</span></td>
          <td align="center"><span class="style10">2</span></td>
          <td align="center"><span class="style10">3</span></td>
          <td align="center"><span class="style10">4</span></td>
          <td align="center"><span class="style10">5</span></td>
          <td align="center"><span class="style10">6</span></td>
          <td align="center"><span class="style10">7</span></td>
          <td align="center"><span class="style10">8</span></td>
		  <td align="center"><span class="style10">9</span></td>
          <td align="center"><span class="style10">10</span></td>
          <td align="center"><span class="style10">11</span></td>
          <td align="center"><span class="style10">12</span></td>
		  <td align="center"><span class="style10">13</span></td>
          <td align="center"><span class="style10">14</span></td>
          <td align="center"><span class="style10">15</span></td>
          <td align="center"><span class="style10">16</span></td>
          <td align="center"><span class="style10">17</span></td>
          <td align="center"><span class="style10">18</span></td>
          <td align="center"><span class="style10">19</span></td>
          <td align="center"><span class="style10">20</span></td>
          <td align="center"><span class="style10">21</span></td>
          <td align="center"><span class="style10">22</span></td>
          <td align="center"><span class="style10">23</span></td>
          <td align="center"><span class="style10">24</span></td>
          <td align="center"><span class="style10">25</span></td>
          <td align="center"><span class="style10">26</span></td>
          <td align="center"><span class="style10">27</span></td>
          <td align="center"><span class="style10">28</span></td>
          <td align="center"><span class="style10">29</span></td>
          <td align="center"><span class="style10">30</span></td>
          <td align="center"><span class="style10">31</span></td>
          <td align="center"><span class="style10">32</span></td>
          <td align="center"><span class="style10">33</span></td>
          <td align="center"><span class="style10">34</span></td>
          <td align="center"><span class="style10">35</span></td>
          <td align="center"><span class="style10">36</span></td>
		  <td align="center"><span class="style10">37</span></td>
          <td align="center"><span class="style10">38</span></td>
          <td align="center"><span class="style10">39</span></td>
          <td align="center"><span class="style10">40</span></td>
          <td align="center"><span class="style10">41</span></td>
		  <td align="center"><span class="style10">42</span></td>
          <td align="center"><span class="style10">43</span></td>
          <td align="center"><span class="style10">44</span></td>
		  <td align="center"><span class="style10">45</span></td>
          <td align="center"><span class="style10">46</span></td>
          <td align="center"><span class="style10">47</span></td>
          <td align="center"><span class="style10">48</span></td>
          <td align="center"><span class="style10">49</span></td>
          <td align="center"><span class="style10">50</span></td>
        </tr>
       
        <?php
	// main loop start	village wise
			
			while($rowReport = mysql_fetch_array($queryReport)) 
			{
			$block_name=$rowReport['block_name'];
			$block_id=$rowReport['block_id'];
			$village_id=$rowReport['village_id'];
			$village_name=$rowReport['village_name'];
			$cen_vill_code=$rowReport['census_village_code'];
			$habitation_name=$rowReport['habitation_name'];
			
			 $sqlScheme="SELECT type_scheme,name_scheme,current_status,duration_supply FROM tbl_dtls_q1_main main, tbl_dtls_q1_last last where main.block_id='$block_id' and main.village_id='$village_id' and main.id=last.loc_id";
			
               $queryScheme=mysql_query($sqlScheme);
               $rowScheme=mysql_fetch_array($queryScheme);
			   $duration=$rowScheme['duration_supply'];
			   $schemeDetails=$rowScheme['type_scheme'];
			   $schemeName=$rowScheme['name_scheme'];
			   $operational_status=$rowScheme['current_status'];
	 
	 // Query for finding HP scheme
	 
			           if($schemeDetails !='HP')
			              {
			          $sqlScheme1="SELECT * FROM tbl_dtls_q2_main where block_id='$block_id' and village_id='$village_id'";
				      $queryScheme1=mysql_query($sqlScheme1);
					  $recordset=mysql_fetch_array($queryScheme1);
				      $num_rows = mysql_num_rows($queryScheme1);
                            if($num_rows > 0)
				               {
			                     $schemeDetails="HP";
								 $schemeName=$recordset['scheme_name'];
								 $operational_status=$recordset['OA_current_status'];
                               }
			              }
    
	 //Query for finding RWSS scheme	
    
	                  if($schemeDetails =='')
			              {	
					      $qryRwss="SELECT village_id FROM tbl_dtls_q1_main where block_id like '%$block%'";
				          $queryRwss=mysql_query($qryRwss);
                          while($rowRwss=mysql_fetch_array($queryRwss))
			                    {
			                       //$rowRwss['village_id']."/".$village_id;
			            		   $vill = explode(",", $rowRwss['village_id']);
			                          if (in_array("$village_id", $vill)) 
				                          {
                                            $schemeDetails="RWSS";
                                          }
			                    }	
									
							}   

			
			$queryHabit="SELECT habitation_code,total_population,sc_population,st_population,habitation_name FROM tbl_lookup_location WHERE block_id='$block_id' and village_id='$village_id' order by habitation_code";
			$ResultHabit = mysql_query($queryHabit);
				$i=1;
				
		//Loop for display habitation list
				
				while($rowHabit = mysql_fetch_array($ResultHabit))
				{
				
			   $habitation_code=$rowHabit['habitation_code'];
			   $total_population=$rowHabit['total_population'];
			   $sc_population=$rowHabit['sc_population'];
			   $st_population=$rowHabit['st_population'];
			   $sc_st_population=$sc_population + $st_population;
			   $gen_population=$total_population - $sc_st_population;
				
				if($total_population!=0)
			{
				if(($sc_st_population/$total_population)>0.5)
				{
				  if(($sc_population/$sc_st_population)>0.5)
				  {
					$column13="SC";
				  }else{
				    $column13="ST";
				    }
				}
				else
				{
					$column13="GEN";
				}
			}
			else
			{
				if(sc_st_population>0.5)
				{
					$column13="SC/ST";
				}
				else
				{
					$column13="GEN";
				}
			} 
			
			// end of column13
			
			//for portable
			
	$qrySource1="SELECT count(source_type) FROM tbl_dtls_q3_water_source_detail src,tbl_dtls_q3_water_source a where a.loc_id=src.loc_id and a.habitation_code='$habitation_code' and src.functional_status='F' and a.habitation_name=src.habitation_name and src.source_type like 'HpGovt%' and src.para_tds <= 3000 and src.para_cl <= 1000 and src.para_f <= 3 and src.para_no3 <= 45 ";
		
		       $recSource1=mysql_query($qrySource1);
               $rowSource1=mysql_fetch_row($recSource1);
			   
	//for NON portable		   
	$qrySource2="SELECT count(source_type) FROM tbl_dtls_q3_water_source_detail src,tbl_dtls_q3_water_source a where a.loc_id=src.loc_id and a.habitation_code='$habitation_code' and src.functional_status='F' and a.habitation_name=src.habitation_name and src.source_type like 'HpGovt%' and ((para_tds >3000) or (para_cl >1000) or (para_f >3) or (para_no3 >45))";
		        
               $recSource2=mysql_query($qrySource2);
               $rowSource2=mysql_fetch_row($recSource2);
			   $qrySource3="SELECT count(source_type) FROM tbl_dtls_q3_water_source_detail src,tbl_dtls_q3_water_source a where a.loc_id=src.loc_id and a.habitation_code='$habitation_code' and src.functional_status='NF' and src.rep_status='Rep' and a.habitation_name=src.habitation_name and src.source_type like 'HpGovt%'";
               $recSource3=mysql_query($qrySource3);
               $rowSource3=mysql_fetch_row($recSource3);
			   
	// Query for portable TW
	
	$qrySourceTW="SELECT count(source_type) FROM tbl_dtls_q3_water_source_detail src,tbl_dtls_q3_water_source a where a.loc_id=src.loc_id and a.habitation_code='$habitation_code' and src.functional_status='F' and a.habitation_name=src.habitation_name and src.source_type like 'TW%' and src.para_tds <= 3000 and src.para_cl <= 1000 and src.para_f <= 3 and src.para_no3 <= 45 ";
		 
			   $recSourceTW=mysql_query($qrySourceTW);
               $rowSourceTW=mysql_fetch_row($recSourceTW);
			   $qryYeild="SELECT a.yield_min FROM tbl_dtls_q1_sws a,tbl_dtls_q1_oh b where a.loc_id=b.loc_id and b.habit_code='$habitation_code' and a.source='Tube-Well'";
                    $recYeild=mysql_query($qryYeild);
                    $rowYeild=mysql_fetch_row($recYeild);
					$minYeild=$rowYeild[0];
					//$sources=$rowYeild[1];
				$qryYeild1="SELECT a.source FROM tbl_dtls_q1_sws a,tbl_dtls_q1_oh b where a.loc_id=b.loc_id and b.habit_code='$habitation_code'";
                    $recYeild1=mysql_query($qryYeild1);
                    $rowYeild1=mysql_fetch_row($recYeild1);
					$sources=$rowYeild1[0];
					
	// NON PORTABLE TW
	
	 $qrySourceTW1="SELECT count(source_type) FROM tbl_dtls_q3_water_source_detail src,tbl_dtls_q3_water_source a where a.loc_id=src.loc_id and a.habitation_code='$habitation_code' and src.functional_status='F' and a.habitation_name=src.habitation_name and src.source_type like 'TW%' and ((para_tds >3000) or (para_cl >1000) or (para_f >3) or (para_no3 >45))";
		         
			   $recSourceTW1=mysql_query($qrySourceTW1);
               $rowSourceTW1=mysql_fetch_row($recSourceTW1);
			   $qrySourceTW2="SELECT count(source_type) FROM tbl_dtls_q3_water_source_detail src,tbl_dtls_q3_water_source a where a.loc_id=src.loc_id and a.habitation_code='$habitation_code' and src.functional_status='NF' and src.rep_status='Rep' and a.habitation_name=src.habitation_name and src.source_type like 'TW%'";
               $recSourceTW2=mysql_query($qrySourceTW2);
               $rowSourceTW2=mysql_fetch_row($recSourceTW2);
			   $queryWater="SELECT b.water_supply,b.duration_supply FROM tbl_dtls_q1_last b,tbl_dtls_q1_oh a where a.loc_id=b.loc_id and a.habit_code='$habitation_code'";
			   $ResultWater = mysql_query($queryWater);
			   $rowWater = mysql_fetch_row($ResultWater);
			
		// if condition appled for shows only MH,not including RWSS Scheme
			   
		   if($i==1 && $schemeDetails!="RWSS")
		   {
		   
			?>
 
 
  <tr>
          <td height="26" align="center"><span class="style10">
		  <?php 
		 
		  echo $rowHabit['habitation_name'];
		  
		  ?></span></td>
          <td align="center"><span class="style10"><?php echo $cen_vill_code;?></span></td>
          <td align="center"><span class="style10"><?php echo $schemeDetails;?></span></td>
          <td align="center"><span class="style10">
		  <?php 
		 
		  echo $rowHabit['habitation_name'];
		  
		  ?></span></td>
          <td align="center"><span class="style10">
		  <?php
		  if($operational_status=="operation")
		  { 
		  echo "FUNCTIONAL";
		  }elseIF($operational_status=="OPERATIONAL"){
		  echo "FUNCTIONAL";
		       }elseIF($operational_status=="defunct"){
		  echo "NOT FUNCTIONAL";
		       }elseIF($operational_status=="DEFUNCT"){
		  echo "NOT FUNCTIONAL";
		       }else{
			    echo $operational_status;
			        }
		  ?>
		  </span></td>
          <td align="center"><span class="style10"><?php echo $column13;?></span></td>
          <td align="center"><span class="style10"><?php echo $total_population;?></span></td>
		  <td align="center"><span class="style10"><?php echo $l=round($total_population*$population_factor);?></span></td>
		  <td align="center"><span class="style10"><?php echo $t=round($total_population*$factor_2025);?></span></td>
          <td align="center"><span class="style10"><?php echo $q=number_format((($total_population*$population_factor)*10)/1000, 2, '.', '');?></span></td>
          <td align="center"><span class="style10"><?php echo $w=number_format((($total_population*$population_factor)*$lpcd)/1000, 2, '.', '');?></span></td>
          <td align="center"><span class="style10"><?php echo $e=number_format((($total_population*$population_factor)*10)/1000, 2, '.', '')+number_format((($total_population*$population_factor)*$lpcd)/1000, 2, '.', '');?></span></td>
		  <td align="center"><span class="style10"><?php echo $i=number_format(($t*10)/1000, 2, '.', '');?></span></td>
          <td align="center"><span class="style10"><?php echo $j=number_format(($t*$lpcd)/1000, 2, '.', '');?></span></td>
          <td align="center"><span class="style10"><?php echo $k=number_format($j+$i, 2, '.', '');?></span></td>
          <td align="center"><span class="style10"><?php echo $HPNos=$rowSource1[0];?></span></td>
          <td align="center"><span class="style10"><?php echo number_format($HPNos*10, 2, '.', '');?></span></td>
          <td align="center"><span class="style10"><?php echo $HPNos1=$rowSource2[0];?></span></td>
          <td align="center"><span class="style10"><?php echo number_format($HPNos1*10, 2, '.', '');?></span></td>
          <td align="center"><span class="style10"><?php echo $HPNos+$HPNos1;?></span></td>
          <td align="center"><span class="style10"><?php echo number_format(($HPNos*10)+($HPNos1*10), 2, '.', '');?></span></td>
          <td align="center"><span class="style10"><?php echo $HPNos2=$rowSource3[0];?></span></td>
          <td align="center"><span class="style10"><?php echo $TWnos=$rowSourceTW[0];?></span></td>
          <td align="center"><span class="style10">
		  <?php 
		  
		  if($schemeDetails=="HP")
		  {
		   $duration="24";
		  }else{
		   $duration=$rowWater[1];
		       }
			          if($duration!="")
			           {
		                 echo $x=number_format(($TWnos*$minYeild*$duration)/8, 2, '.', '');
					   }else{
					     echo "NP";
					        }
		  ?>
		  </span></td>
          <td align="center"><span class="style10"><?php echo $TWnos1=$rowSourceTW1[0];?></span></td>
          <td align="center"><span class="style10"><?php echo $y=number_format($TWnos1*$minYeild, 2, '.', '');?></span></td>
          <td align="center"><span class="style10"><?php echo ($TWnos+$TWnos1);?></span></td>
          <td align="center"><span class="style10"><?php echo number_format($x+$y, 2, '.', '');?></span></td>
          <td align="center"><span class="style10"><?php echo $TWnos2=$rowSourceTW2[0];?></span></td>
          <td align="center"><span class="style10">
		  <?php 
		  if($sources=="Canal" || $sources=="Ponds" || $sources=="Diggies")
		   {
		    echo number_format($rowWater[0], 2, '.', '');
		   }else{
		    echo " ";
		        }
		  ?>
		  </span></td>
          <td align="center"><span class="style10"><?php echo $m=number_format(($HPNos*10)+$x+$rowWater[0], 2, '.', '');?></span></td>
          <td align="center"><span class="style10"><?php echo $n=number_format(($HPNos1*10)+$y, 2, '.', '');?></span></td>
          <td align="center"><span class="style10"><?php echo $final=number_format($m+$n, 2, '.', '');?></span></td>
          <td align="center"><span class="style10">
		  <?php 
		  if($m >= $q)
		  {
		  echo"0.00";
		  }else{
		  echo $min=number_format($m-$q, 2, '.', '');
		       }
		  
		  ?>
		  </span></td>
          <td align="center">
		  <span class="style10">
		  <?php 
		  if($m >= $q)
		  {
		  echo $min1=number_format($n+($m-$q)-$w, 2, '.', '');
		  }else{
		  echo $min=number_format($n-$w, 2, '.', '');
		       }
		  
		  ?>
		  </span>
		  </td>
          <td align="center"><span class="style10"><?php echo number_format($final-$e, 2, '.', '');?></span></td>
		  <td align="center"><span class="style10">
		  <?php 
		  if($m >= $i)
		  {
		  echo"0.00";
		  }else{
		  echo $minimum=number_format($m-$i, 2, '.', '');
		       }
		  
		  ?>
		  </span></td>
          <td align="center">
		   <span class="style10">
		  <?php 
		  if($m >= $i)
		  {
		  echo $minimum1=number_format($n+($m-$i)-$w, 2, '.', '');
		  }else{
		  echo $minimum1=number_format($n-$j, 2, '.', '');
		       }
		  
		  ?>
		  </span>
		  </td>
          <td align="center"><span class="style10"><?php echo number_format($final-$k, 2, '.', '');?></span></td>
          <td align="center"><span class="style10">
		  <?php 
		  if($schemeDetails=="HP")
		  {
		  echo $duration="24";
		  }else{
		  
		  echo $duration="8";
		       }
		  ?>
		  </span></td>
          <td align="center"><span class="style10">
		  <?php 
		  if($schemeDetails=="HP")
		  {
		  echo $duration="24";
		  }else{
		  
		  echo $rowWater[1];
		       }
		  ?>
		  </span></td>
		  <td align="center">
		  <span class="style10">
		  <?php 
		  if($m < $q)
		  {
		  echo $result=round(($m*1000)/$l);
		  }else{
		  echo $result=10;
		       }
		  
		  ?>
		  </span>
		  </td>
          <td align="center">
		   <span class="style10">
		  <?php 
		  if($m <= $q)
		  {
		  echo $result=round(($n*1000)/$l);
		  }else{
		  echo $result=round(($n+($m-$q))*1000/$l);
		       }
		  
		  ?>
		  </span>
		  </td>
          <td align="center">
		   <span class="style10">
		   <?php 
		   echo $result1=round(($final*1000)/$l);
		   ?>
		   </span>
		  </td>
		  <td align="center">
		  <span class="style10">
		  <?php 
		  if($m < $i)
		  {
		  echo $result=round(($m*1000)/$t);
		  }else{
		  echo $result=10;
		       }
		  
		  ?>
		  </span>
		  </td>
          <td align="center">
		   <span class="style10">
		  <?php 
		  if($m <= $i)
		  {
		  echo $result=round(($n*1000)/$t);
		  }else{
		  echo $result=round(($n+($m-$i))*1000/$t);
		       }
		  
		  ?>
		  </span>
		  </td>
          <td align="center">
		   <span class="style10">
		   <?php 
		   echo $result2=round(($final*1000)/$t);
		   ?>
		   </span>
		  </td>
          <td align="center">&nbsp;</td>
          <td align="center">&nbsp;</td>
          <td align="center">&nbsp;</td>
        </tr>
 
        
<?php  
     
	$i++;  
}
/*----end if condition------*/
}
/*-----end loop for habitation(MH) wise-----*/
} 
/*-----end main loop-----*/
?>
         
      </table></td>
	</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>